package com.shemy.service.impl;

import com.shemy.mapper.UserMapper;
import com.shemy.entity.User;
import com.shemy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description ServiceImpl
 * @Author Dzsom
 * @Date 2019-04-03 23:40
 * @Encoding UTF-8
 * @Version 1.0
 **/
@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    @Transactional
    public int save(User user) {
        return userMapper.save(user);
    }

    @Override
    public List<User> listAll() {
        return userMapper.listAll();
    }

    @Override
    public User findById(long id) {
        return userMapper.findById(id);
    }

    @Override
    @Transactional
    public int deleteById(long id) {
        return userMapper.delete(id);
    }

    @Override
    @Transactional
    public int update(User user) {
        return userMapper.update(user);
    }
}
